from django.shortcuts import render, HttpResponse


def login(request):
    print(request.method)
    if request.method == 'GET':
        print(333)
        return render(request, 'login.html')
    else:
        name = request.POST.get('username')
        pwd = request.POST.get('pwd')
        if name == "周道镕" and pwd == "123":
            return render(request, 'index.html')
            # return HttpResponse("登录成功")
        else:
            return render(request, 'fail.html')
            # return HttpResponse('登录失败！')


def news1(request, year):
    return HttpResponse(year+'年所有的报纸')


def news2(request, month, year):
    return HttpResponse(year+'年'+month+'月的所有的报纸')


